package com.ccy.product.web;

import com.ccy.product.service.SkuInfoService;
import com.ccy.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @author coder_ccy
 * @date 2022/7/26 9:58
 */

@Controller
public class ItemController {


    @Autowired
    private SkuInfoService skuInfoService;



    @GetMapping("/{skuId}.html")
    public String item(@PathVariable("skuId") long skuId, Model model) throws ExecutionException, InterruptedException {

        SkuItemVo item= skuInfoService.getSkuInfoById(skuId);
        model.addAttribute("model",model);

        return "item";
    }
}
